/**
 *
 */

var app = getApp()
Page({
	data: {
		root: app.setting.att_url,
		banner: [],
		goods: [],
		page:1,
		pagedata:[],
		pagetitle:'签到日志' + '-' + app.setting.title,
		bannerHeight: Math.ceil(290.0 / 750.0 * getApp().screenWidth)
	},
	onPullDownRefresh: function (){
		var the=this;
		var opt={};
		the.onLoad(opt);
		setTimeout(function(){
			wx.stopPullDownRefresh()
		},1000);
	},
	onLoad: function (options){
		var the = this
		wx.setNavigationBarTitle({'title':the.data.pagetitle});
		var type = options.type
		app.util.get(app.access,function(pagedata){
			pagedata.list=pagedata.list?pagedata.list:[]
			the.setData({
				pagedata:pagedata,
				loading:false
			});
			the.getlist(1);
		});
		
	},
	getlist: function(e){
		var the = this
		var isnodata = the.data.isnodata;
		var page = the.data.page;
		var pagedata = the.data.pagedata;
		app.util.get('core/member.qd_log/list/page='+page,function(res){
			//console.log('2121');console.log(res);
			//加载分页
			if(res.length>0){
					pagedata.list = pagedata.list.concat(res);
					page++;
			}else{
					isnodata = true
			}
			the.setData({
				pagedata:pagedata,
				page:page,
				isnodata:isnodata,
				loading:false
			});
		});
	},
	click:function(evt){
		//用户点击事件 data.func 为方法名，data.params 为调用参数！
		var data=evt.currentTarget.dataset;
		//console.log(evt);
		app.util[data.func](data.params);
	},
})